package co.edu.ucatolica.sislab.users;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import co.edu.ucatolica.sislab.persistence.DatabaseException;
import co.edu.ucatolica.sislab.persistence.dao.UserPersitorHelper;
import co.edu.ucatolica.sislab.persistence.dto.UserDTO;
import co.edu.ucatolica.sislab.users.domain.UserBean;
import co.edu.ucatolica.sislab.users.domain.UserDataBean;

public class UserService {
	/** Permite registrar mensajes del sistema.*/
	private static Logger logger = LoggerFactory.getLogger(UserService.class);
	
	public static Long autenticateUser(Long transactionNumber, UserBean userBean) throws DatabaseException{
		UserDTO userDTO = UserUtils.builtUserDTO(userBean);
		return UserPersitorHelper.autenticateUser(transactionNumber, userDTO);
	}

	public static UserDataBean getUserDataBeanByCode(Long transactionNumber, UserDataBean userDataBean) throws DatabaseException {
		UserDTO userDTO = UserUtils.builtUserDTO(userDataBean);
		return UserPersitorHelper.getUserDataBeanByCode(transactionNumber, userDTO);
	}

	public static Long createUser(Long transactionNumber, UserBean userBean) throws DatabaseException {
		UserDTO userDTO = UserUtils.builtUserDTO(userBean);
		return UserPersitorHelper.createUser(transactionNumber, userDTO);
	}
}
